Passed
Push — master ( 0543ef...cf6673 )
by Miloš
02:59
created

AnonymousAuth   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 3
eloc 17
dl 0
loc 21
rs 10
c 0
b 0
f 0

3 Functions

Rating   Name   Duplication   Size   Complexity  
A handleBrowserLogin 0 3 1
A getBrowserLoginProvider 0 3 1
A handleNativeLogin 0 3 1
1
import { Injectable } from "@angular/core";
2
import { AngularFireAuth } from "@angular/fire/auth";
3
import { Platform } from "@ionic/angular";
4
import { auth } from "firebase/app";
5
import { AbstractAuth } from "../../providers/abstract-auth";
6
import { IAuthProvider } from "../../providers/i-auth-provider";
7
8
@Injectable({
9
    providedIn: "root",
10
})
11
export class AnonymousAuth extends AbstractAuth implements IAuthProvider {
12
    public readonly providerOptions = {};
13
14
    public constructor(angularFireAuth: AngularFireAuth, platform: Platform) {
15
        super(angularFireAuth, platform);
16
    }
17
18
    public async handleNativeLogin(options: any): Promise<auth.UserCredential> {
19
        return this.handleBrowserLogin();
20
    }
21
22
    public async handleBrowserLogin(): Promise<auth.UserCredential> {
23
        return await auth().signInAnonymously();
24
    }
25
26
    protected getBrowserLoginProvider(): null {
27
        return null;
28
    }
29
}
30